package com.iplant.wms.service.po.wpo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.join.multi.select.DBJoinMultiSelect;
import com.iplant.base.utils.annotation.po.DBBasePO;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

/**
 * 采购订单
 *
 * @author femi
 * @CreateTime 2022-4-2 22:03:07
 */
@DBBasePO(TableName = "wms_purchaseorder", CheckName = {"Code"},Name = false,Active = false,
        Schemas = DBSchemas.WMS, CodeAuto = true, CodePrefix = "PO{yyMM}",CodeNum = 5)
public class WMSPurchaseOrder extends BasePO implements Serializable {

    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;


    @DBCondition
    @DBField
    public int FactoryID = 0;

    @DBJoin(name = "Code", tableName = "fmc_factory", tableAsName = "f1",
            Schemas = DBSchemas.Basic, MainTableField = "FactoryID")
    public String FactoryCode = "";

    @DBJoin(name = "Name", tableName = "fmc_factory", tableAsName = "f1",
            Schemas = DBSchemas.Basic, MainTableField = "FactoryID")
    public String FactoryName = "";
    /**
     * 采购订单类型   Code 自动生成或者前端输入 Code 不准修改
     */
    @DBField
    public int TypeID = 0;
    @DBJoin(name = "Name", tableName = "wms_bill_type", Schemas = DBSchemas.WMS, tableAsName = "bt1", MainTableField = "TypeID")
    public String TypeName = "";

    @DBJoin(name = "Code", tableName = "wms_bill_type", Schemas = DBSchemas.WMS, tableAsName = "bt1", MainTableField = "TypeID")
    public String TypeCode = "";

    /**
     * 货主 就是客户
     */
    @DBCondition
    @DBField
    public int CustomerID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "crm_customer", tableAsName = "c1",
            Schemas = DBSchemas.Basic, MainTableField = "CustomerID")
    public String CustomerCode = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "crm_customer", tableAsName = "c1",
            Schemas = DBSchemas.Basic, MainTableField = "CustomerID")
    public String CustomerName = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like,ParamName2 = "ProjectNoEQ")
    @DBField
    public String ProjectNo = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like, ParamName2 = "ProjectNameEQ")
    @DBField
    public String ProjectName = "";
    /**
     * 到货开始时间
     */
    @DBField
    public Calendar ArriveStartTime = Calendar.getInstance();

    /**
     * 到货结束时间
     */
    @DBField
    public Calendar ArriveEndTime = Calendar.getInstance();

    @DBField
    public String POReference1 = "";
    @DBField
    public String POReference2 = "";
    @DBField
    public String POReference3 = "";
    @DBField
    public String POReference4 = "";
    @DBField
    public String POReference5 = "";

    @DBField
    public String UserDefine1 = "";
    @DBField
    public String UserDefine2 = "";
    @DBField
    public String UserDefine3 = "";
    @DBField
    public String UserDefine4 = "";
    @DBField
    public String UserDefine5 = "";

    /**
     * 供应商
     */
    @DBCondition
    @DBField
    public int SupplierID = 0;
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "crm_customer", tableAsName = "c2",
            Schemas = DBSchemas.Basic, MainTableField = "SupplierID")
    public String SupplierCode = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "crm_customer", tableAsName = "c2",
            Schemas = DBSchemas.Basic, MainTableField = "SupplierID")
    public String SupplierName = "";
    @DBField
    public String SupplierAddress = "";

    @DBField
    public String SupplierContact = "";

    @DBField
    public String SupplierTel = "";

    @DBJoinMultiSelect(OutTableField = "PurchaseOrderID", ItemClazz = WMSPurchaseOrderItem.class)

    public List<WMSPurchaseOrderItem> ItemList = new ArrayList<>();

    /**
     * 默认收货仓库
     */
    @DBCondition
    @DBField
    public int StoreID = 0;

    @DBJoin(name = "Name", tableName = "wms_store", tableAsName = "st4",
            JoinMode = DBJoin.DBJoinMode.Left,
            Schemas = DBSchemas.WMS, MainTableField = "StoreID")
    public String StoreName = "";
    @DBJoin(name = "Code", tableName = "wms_store", tableAsName = "st4",
            JoinMode = DBJoin.DBJoinMode.Left,
            Schemas = DBSchemas.WMS, MainTableField = "StoreID")
    public String StoreCode = "";
    @DBField
    public String CreateSource = "";

    /**
     * 到货单状态，前端需要判断是否已生成过收货单
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.in)
    @DBField
    public int Status = 0;

    public String StatusText = "";


    public WMSPurchaseOrder() {
        super();
    }

    @JsonProperty("TypeID")
    public int getTypeID() {
        return TypeID;
    }

    public void setTypeID(int typeID) {
        TypeID = typeID;
    }

    @JsonProperty("TypeCode")
    public String getTypeCode() {
        return TypeCode;
    }

    public void setTypeCode(String typeCode) {
        TypeCode = typeCode;
    }

    @JsonProperty("TypeName")
    public String getTypeName() {
        return TypeName;
    }

    public void setTypeName(String typeName) {
        TypeName = typeName;
    }

    @JsonProperty("CustomerID")
    public int getCustomerID() {
        return CustomerID;
    }

    public void setCustomerID(int customerID) {
        CustomerID = customerID;
    }

    @JsonProperty("CustomerCode")
    public String getCustomerCode() {
        return CustomerCode;
    }

    public void setCustomerCode(String customerCode) {
        CustomerCode = customerCode;
    }

    @JsonProperty("CustomerName")
    public String getCustomerName() {
        return CustomerName;
    }

    public void setCustomerName(String customerName) {
        CustomerName = customerName;
    }

    @JsonProperty("ArriveStartTime")
    public Calendar getArriveStartTime() {
        return ArriveStartTime;
    }

    public void setArriveStartTime(Calendar arriveStartTime) {
        ArriveStartTime = arriveStartTime;
    }

    @JsonProperty("ArriveEndTime")
    public Calendar getArriveEndTime() {
        return ArriveEndTime;
    }

    public void setArriveEndTime(Calendar arriveEndTime) {
        ArriveEndTime = arriveEndTime;
    }

    @JsonProperty("POReference1")
    public String getPOReference1() {
        return POReference1;
    }

    public void setPOReference1(String POReference1) {
        this.POReference1 = POReference1;
    }

    @JsonProperty("POReference2")
    public String getPOReference2() {
        return POReference2;
    }

    public void setPOReference2(String POReference2) {
        this.POReference2 = POReference2;
    }

    @JsonProperty("POReference3")
    public String getPOReference3() {
        return POReference3;
    }

    public void setPOReference3(String POReference3) {
        this.POReference3 = POReference3;
    }

    @JsonProperty("POReference4")
    public String getPOReference4() {
        return POReference4;
    }

    public void setPOReference4(String POReference4) {
        this.POReference4 = POReference4;
    }

    @JsonProperty("POReference5")
    public String getPOReference5() {
        return POReference5;
    }

    public void setPOReference5(String POReference5) {
        this.POReference5 = POReference5;
    }

    @JsonProperty("UserDefine1")
    public String getUserDefine1() {
        return UserDefine1;
    }

    public void setUserDefine1(String userDefine1) {
        UserDefine1 = userDefine1;
    }

    @JsonProperty("UserDefine2")
    public String getUserDefine2() {
        return UserDefine2;
    }

    public void setUserDefine2(String userDefine2) {
        UserDefine2 = userDefine2;
    }

    @JsonProperty("UserDefine3")
    public String getUserDefine3() {
        return UserDefine3;
    }

    public void setUserDefine3(String userDefine3) {
        UserDefine3 = userDefine3;
    }

    @JsonProperty("UserDefine4")
    public String getUserDefine4() {
        return UserDefine4;
    }

    public void setUserDefine4(String userDefine4) {
        UserDefine4 = userDefine4;
    }

    @JsonProperty("UserDefine5")
    public String getUserDefine5() {
        return UserDefine5;
    }

    public void setUserDefine5(String userDefine5) {
        UserDefine5 = userDefine5;
    }

    @JsonProperty("SupplierID")
    public int getSupplierID() {
        return SupplierID;
    }

    public void setSupplierID(int supplierID) {
        SupplierID = supplierID;
    }

    @JsonProperty("SupplierCode")
    public String getSupplierCode() {
        return SupplierCode;
    }

    public void setSupplierCode(String supplierCode) {
        SupplierCode = supplierCode;
    }

    @JsonProperty("SupplierName")
    public String getSupplierName() {
        return SupplierName;
    }

    public void setSupplierName(String supplierName) {
        SupplierName = supplierName;
    }

    @JsonProperty("SupplierAddress")
    public String getSupplierAddress() {
        return SupplierAddress;
    }

    public void setSupplierAddress(String supplierAddress) {
        SupplierAddress = supplierAddress;
    }

    @JsonProperty("SupplierContact")
    public String getSupplierContact() {
        return SupplierContact;
    }

    public void setSupplierContact(String supplierContact) {
        SupplierContact = supplierContact;
    }

    @JsonProperty("SupplierTel")
    public String getSupplierTel() {
        return SupplierTel;
    }

    public void setSupplierTel(String supplierTel) {
        SupplierTel = supplierTel;
    }

    @JsonProperty("ItemList")
    public List<WMSPurchaseOrderItem> getItemList() {
        return ItemList;
    }

    public void setItemList(List<WMSPurchaseOrderItem> itemList) {
        ItemList = itemList;
    }

    @JsonProperty("StoreID")
    public int getStoreID() {
        return StoreID;
    }

    public void setStoreID(int storeID) {
        StoreID = storeID;
    }

    @JsonProperty("StoreCode")
    public String getStoreCode() {
        return StoreCode;
    }

    public void setStoreCode(String storeCode) {
        StoreCode = storeCode;
    }

    @JsonProperty("StoreName")
    public String getStoreName() {
        return StoreName;
    }

    public void setStoreName(String storeName) {
        StoreName = storeName;
    }

    @JsonProperty("CreateSource")
    public String getCreateSource() {
        return CreateSource;
    }

    public void setCreateSource(String createSource) {
        CreateSource = createSource;
    }

    @JsonProperty("FactoryID")
    public int getFactoryID() {
        return FactoryID;
    }

    public void setFactoryID(int factoryID) {
        FactoryID = factoryID;
    }

    @JsonProperty("FactoryCode")
    public String getFactoryCode() {
        return FactoryCode;
    }

    public void setFactoryCode(String factoryCode) {
        FactoryCode = factoryCode;
    }

    @JsonProperty("FactoryName")
    public String getFactoryName() {
        return FactoryName;
    }

    public void setFactoryName(String factoryName) {
        FactoryName = factoryName;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    @JsonProperty("StatusText")
    public String getStatusText() {
        return StatusText;
    }

    public void setStatusText(String statusText) {
        StatusText = statusText;
    }

    @JsonProperty("ProjectNo")
    public String getProjectNo() {
        return ProjectNo;
    }

    public void setProjectNo(String projectNo) {
        ProjectNo = projectNo;
    }
    @JsonProperty("ProjectName")
    public String getProjectName() {
        return ProjectName;
    }

    public void setProjectName(String projectName) {
        ProjectName = projectName;
    }
}
